<?php

/**
 * ShippingZone form.
 *
 * @package    jobeet
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class ShippingZoneForm extends BaseShippingZoneForm
{
	
  static $multiLangFields = array('name' => array('title' => 'Nimi'));
   
  public function configure(){
  	
  	$this->setI18Languages();


  	# Transport types
  	$result = Doctrine_Core::getTable('TransportType')->findAll();
	$types = array();
	foreach ($result as $res) {
	  $types[$res['id']] = $res['name'];
	}

	$this->widgetSchema['transport_type_id'] =  new sfWidgetFormDoctrineChoice(
		array('model' => $this->getRelatedModelName('TransportType'), 'add_empty' => true));

	if( $tId = $this->getObject()->getTransportTypeId() ){
		$this->widgetSchema['transport_type_id']->setDefault($tId);
	}
  }
  
  public function setI18Languages(){
  	$this->embedI18n($this->getLanguages());
  }
  
  public function getLanguages(){
  	return array('et','en');
  }
  
}
